{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox-title">
        <h5>关卡信息</h5>
    </div>
    <div class="ibox-content layui-form">
        <div class="layui-row layui-col-space10 layui-form-item ">
            <input type="hidden" name="id" value="{$info['rg_id']}">
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <label class="layui-form-label">关卡名称：</label>
                <div class="layui-input-block">
                    <input type="text" name="rg_name" value="{$info['rg_name']}" lay-verify="required" class="layui-input ">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <label class="layui-form-label">经验值：</label>
                <div class="layui-input-block">
                    <input type="text" onkeyup="this.value=this.value.replace(/\D/gi,'')" name="rg_exp" value="{$info['rg_exp']}" lay-verify="required" class="layui-input ">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <label class="layui-form-label">金币：</label>
                <div class="layui-input-block">
                    <input type="text" onkeyup="this.value=this.value.replace(/\D/gi,'')" name="rg_score" value="{$info['rg_score']}" lay-verify="required" class="layui-input ">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <label class="layui-form-label">优惠卷：</label>
                <div class="layui-input-block">
                    <select name="rb_grade_id">
                        {foreach name="info1" item="vv"}
                        <option value="{$vv.coupon_id}" {if $vv['coupon_id']==$info['rg_coupon']}selected{/if}>{$vv.coupon_name}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <label class="layui-form-label">排序：</label>
                <div class="layui-input-block">
                    <input type="text" name="rg_order"
                           onkeyup="this.value=this.value.replace(/\D/gi,'')"value="{$info['rg_order']}" lay-verify="required" class="layui-input ">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    layui.use(['form'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('edit')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('book/checkpoint')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>
</body>
</html>